﻿using System;
using System.Reflection;
using TestMonkey.Models;

namespace TestMonkey.TestRunners
{
    public abstract class NUnit : TestRunner
    {
        public override CodeString TestClassAttribute
        {
            get { return "[TestFixture]"; }
        }

        public override CodeString TestAttribute
        {
            get { return String.Format(@"[Test, GeneratedCode(""TestMonkey"", ""{0}"")]", Assembly.GetExecutingAssembly().GetName().Version.ToString()); }
        }

        public override CodeString ManualTestAttribute
        {
            get { return @"[Test]"; }
        }

        public override CodeString Imports
        {
            get { return "using NUnit.Framework;" + Environment.NewLine + "using System.CodeDom.Compiler;"; }
        }

        public override CodeString Inconclusive(string message)
        {
            return string.Format("Assert.Inconclusive({0});", message);
        }

        public override CodeString IsTrue(string actual)
        {
            return string.Format("Assert.IsTrue({0});", actual);
        }

        public override CodeString IsFalse(string actual)
        {
            return string.Format("Assert.IsFalse({0});", actual);
        }

        public override CodeString IsNull(string actual)
        {
            return string.Format("Assert.IsNull({0});", actual);
        }

        public override CodeString IsTrue(string actual, string message)
        {
            return string.Format("Assert.IsTrue({0}, {1});", actual, message);
        }

        public override CodeString IsFalse(string actual, string message)
        {
            return string.Format("Assert.IsFalse({0}, {1});", actual, message);
        }

        public override CodeString IsNull(string actual, string message)
        {
            return string.Format("Assert.IsNull({0}, {1});", actual, message);
        }

        public override CodeString Fail(string message)
        {
            return string.Format("Assert.Fail({0});", message);
        }

        public override CodeString AreEqual(string expected, string actual, string message)
        {
            return String.Format("Assert.AreEqual({0}, {1}, {2});", expected, actual, message);
        }

    }

}
